package com.home.duy.code.FileFilter;

import java.awt.image.BufferedImage;
import java.io.File;
import javax.swing.filechooser.*;

import com.home.Common.Common;
import com.home.duy.code.Helper.UtilsFileImage;


public class ImageFileFilter extends FileFilter{

	@Override
	public boolean accept(File f) {
		if(f.isDirectory())
		{
			return true;
		}
		String extension = UtilsFileImage.getExtension(f);
		if(extension != null)
		{
			if (extension.equals(UtilsFileImage.gif) ||
	                extension.equals(UtilsFileImage.jpeg) ||
	                extension.equals(UtilsFileImage.jpg) ||
	                extension.equals(UtilsFileImage.png)) {
	                    return true;
	            } else {
	                return false;
	            }
			
		}
		return false;
	}
	
	
	@Override
	public String getDescription() {
		return "*.gif, *.jpeg, *.jpg, *.png";
	}

}
